//
//  OMOrderEmptyTableViewCell.m
//  FruitsWholesaler
//
//  Created by sgone-2 on 16/4/26.
//  Copyright © 2016年 sgone. All rights reserved.
//

#import "OMOrderEmptyTableViewCell.h"
#import "Common.h"
#import "UIView+Helper.h"
#import "labelAdaptive.h"
@implementation OMOrderEmptyTableViewCell


+ (instancetype)cellWithTableView:(UITableView *)tableView {
    static NSString *ID = @"orderEmptyCell";
    OMOrderEmptyTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"OMOrderEmptyTableViewCell" owner:nil options:nil] objectAtIndex:0];
    }
    return cell;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    self.backgroundColor = FDBack_COLOR;
}



- (CGFloat)setEmptyOrderCell {
    
    self.userInteractionEnabled = NO;

    
    _emptyImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"null_default"]];
    _emptyImageView.contentMode = UIViewContentModeScaleAspectFit;
    
    CGFloat Width;
    CGFloat Height;
    
    if (self.tableViewWidth) {
        
        Width = self.tableViewWidth;
    } else {
        
        Width = ViewWidth;
    }
    
    if (self.headerViewHeight) {
        
        Height = ViewHeight - self.headerViewHeight;
    } else {
        
        Height = ViewHeight;
    }
    
    CGFloat width = Width / 3;
    
    _emptyLabel = [[UILabel alloc] init];
    _emptyLabel.text = @"暂无内容";
    _emptyLabel.textColor = [UIColor grayColor];
    _emptyLabel.font = [UIFont systemFontOfSize:14.0 / FDLaOt];
    CGSize emptySize = [labelAdaptive sizeWithString:_emptyLabel.text font:_emptyLabel.font];
    
    _emptyImageView.frame = CGRectMake(width, (Height - 150 - width - 20 - emptySize.height) / 2, width, width);
    _emptyLabel.frame = CGRectMake((Width - emptySize.width) / 2, _emptyImageView.y + _emptyImageView.height, emptySize.width, emptySize.height);
    
    [self addSubview:_emptyImageView];
    [self addSubview:_emptyLabel];
    
    self.backgroundColor = FDBack_COLOR;
    
    return Height - 60;
}



@end
